import React, { Component } from 'react'

import '../assets/style/card.less'
//gwx  
//gwx   gwx//gwx  
//gwx   gwx//gwx  
//gwx   gwx
export default class FormCard extends Component {
    constructor(props) {
        super(props)
        this.state = {
            data: this.props.data
        }
        this.skipdetails = this.skipdetails.bind(this)
    }
    skipdetails(e) {
        console.log(e)

    }
    render() {
        console.log(this.state.data, '传过来的值')
        let arr = this.state.data.tag.split(" ")

        return (
            <a href={this.props.href +'/'+this.props.data.id}>
                  <div className="card" onClick={() => this.skipdetails(this.props.data)}>
                <div className="card-img">
                    <img src={this.props.data.image} alt="" />
                </div>
                <div className="card-text">
                    <div className="text-title">
                        <span>{this.props.data.title}</span>
                        {this.props.data.status === '0' ? <span className="one">新盘</span> : <span className="two">在售</span>}
                    </div>
                    <div className="text-region">
                        <span>{this.props.data.area}</span><span>{this.props.data.price}元/m²</span>
                    </div>
                    <div className="text-hall">{this.props.data.type}</div>
                    <div className="text-label">
                        {arr.map((val, index) => {
                            return (
                                <span key={index} >{val}</span>
                            )
                        })}
                    </div>
                </div>

            </div>
            </a>

        )
    }
}
